<div id="adminToolbar" class="toolbar<?php echo $admin ? '' : ' hidden'; ?> robots-nocontent">
  <?php if ($admin): ?>
    <ul>
      <li>
        <a href="<?php echo $adminUrl; ?>/article" title="Post a new article">
          <img src="<?php echo $themeUrl; ?>/images/toolbar/article_new.png"
              alt="New Article" />
        </a>
      </li>
      
      <?php if (isset($article) && $article->id): ?>
        <li>
          <a href="<?php echo $adminUrl; ?>/article?articleId=<?php echo $article->id; ?>"
              title="Edit this article">
            <img src="<?php echo $themeUrl; ?>/images/toolbar/article_edit.png"
                alt="Edit Article" />
          </a>
        </li>
      <?php endif; ?>
      
      <li>
        <a href="<?php echo $adminUrl; ?>/page" title="Create a new page">
          <img src="<?php echo $themeUrl; ?>/images/toolbar/page_new.png"
              alt="New Page" />
        </a>
      </li>
      
      <?php if (isset($page) && $page->id): ?>
        <li>
          <a href="<?php echo $adminUrl; ?>/page?pageId=<?php echo $page->id; ?>"
              title="Edit this page">
            <img src="<?php echo $themeUrl; ?>/images/toolbar/page_edit.png"
                alt="Edit Page" />
          </a>
        </li>
      <?php endif; ?>
    </ul>
    
    <form action="<?php echo $siteUrl; ?>/logout" method="post">
      <div>
        <input type="hidden" name="originalUrl"
            value="<?php echo htmlentities($pageUrl); ?>" />
        <input type="submit" value="Log out" />
      </div>
    </form>
  <?php else: ?>
    <form id="login" action="<?php echo $siteUrl; ?>/login" method="post">
      <div>
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" maxlength="64"
            title="Enter your username" />

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" maxlength="64"
            title="Enter your password" />

        <input type="hidden" name="originalUrl"
            value="<?php echo htmlentities($pageUrl); ?>" />

        <input type="submit" value="Login" />
      </div>
    </form>
  <?php endif; ?>
</div>
